const connection = require("../app/database");

class permissionService {
  async queryPermissions(resouce, momentId, userId) {
    const statement = `SELECT * FROM ${resouce} WHERE id = ? AND user_id = ?`;

    const [result] = await connection.execute(statement, [momentId, userId]);
    return !!result.length;
  }
}

module.exports = new permissionService();
